package cn.zhaoyuening.fandamin.utils.page;

import java.util.ArrayList;
import java.util.List;

/**
 * 存放分页信息
 * @author Zhao
 *
 */
public class PageBean<T> {
	
	//分页大小
	private int pageSize;
	//当前分页
	private int pageNum=1;
	//记录总量
	private int totalRecord;
	
	//存放元素
	List<T> data = new ArrayList<T>();
	
	//开始索引位置
	private int startIndex;
	//总页数
	private int totalPage;
	
	
	
	public PageBean(int pageSize, int pageNum, int totalRecord) {
		this.pageSize = pageSize;
		this.pageNum = pageNum;
		this.totalRecord = totalRecord;
		//计算 startPage 及 startIndex
		totalPage = (totalRecord-1)/pageSize + 1;
		startIndex = (pageNum-1)*pageSize+1;
	}
	

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalRecord = totalRecord;
	}

	public int getStartIndex() {
		return startIndex;
	}

	public void setStartIndex(int startIndex) {
		this.startIndex = startIndex;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}


	public List<T> getData() {
		return data;
	}


	public void setData(List<T> data) {
		this.data = data;
	}
	
	
	
	
}
